home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / doors / multichatdoor / getinput.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-05  |  895 b   |  55 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <exec/exec.h>
  4. #include <exec/types.h>
  5. #include <clib/exec_protos.h>
  6. #include <exec/memory.h>
  7. #include <doorheader.h>
  8. #include "MultiChat.h"
  9.  
  10. char GetInput(void)
  11. {
  12.     struct StatusStruct
  13.     {
  14.         UWORD    Status;
  15.         char        Text[1];
  16.         char        Sender[30];
  17.     };
  18.     struct StatusStruct *Status;
  19.  
  20.     char        Input;
  21.     char        MyChar[1];
  22.     char        NodeNr_char[200];
  23.  
  24.     UWORD    NodeNr;
  25.  
  26.     BOOL        DidIGetIt = FALSE;
  27.  
  28.  
  29.     getuserstring(NodeNr_char, BB_NODEID);
  30.     NodeNr = atoi(NodeNr_char);
  31.  
  32.     Status = AllocMem(sizeof(struct StatusStruct), MEMF_FAST | MEMF_CLEAR);
  33.  
  34.     while(DidIGetIt != TRUE)
  35.     {
  36.         CheckMsg(Status);
  37.         if (Status->Status == CHATMSG)
  38.         {
  39.             sendmessage(Status->Text, 0);
  40.         }
  41.         DidIGetIt = getkey();
  42.  
  43.         // Do a pause here?
  44.         // Delay(30L);
  45.     }
  46.  
  47.     hotkey("", MyChar);
  48.     Input = MyChar[0];
  49.     sendmessage(MyChar, 0);
  50.         
  51.     FreeMem(Status, sizeof(struct StatusStruct));
  52.  
  53.     return(Input);
  54. }
  55.